#ifndef CLOCKSTATCALENDARMODEL_H
#define CLOCKSTATCALENDARMODEL_H
// Qt lib import
#include <QObject>
#include <QAbstractListModel>
#include <QDebug>
#include <QString>
#include <QHash>
#include <QNetworkReply>

class ClockStatCalendarModel: public QAbstractListModel
{
    Q_OBJECT

public:
    struct Contact {
        QString date;
        double status;
    };
    enum ContactRole {
        DateRole = Qt::DisplayRole,
        StatusRole = Qt::UserRole,
    };
    Q_ENUM(ContactRole)

    ClockStatCalendarModel(QObject *parent = nullptr);

    int rowCount(const QModelIndex & = QModelIndex()) const;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    QHash<int, QByteArray> roleNames() const;

    Q_INVOKABLE QVariantMap get(int row) const;
    Q_INVOKABLE QVariantMap getByDate(QString date);
    Q_INVOKABLE void append(const Contact contact);
    Q_INVOKABLE bool hasByDate(QString date);

private:

    QHash<QString,int> calendar_keys;
    QList<Contact> m_contacts;

};
#endif // CLOCKSTATCALENDARMODEL_H
